<?php 
define('BLOCKLOGIN','1.00');

/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


//user login block
//carica la lingua se esiste
$lang=lang();
switch($lang){
    case "en":
	define("_USER_LOGIN","User Login");
	define("_USER","User");
	define("_PASSWORD","Password");
	define("_PER_ENTRARE","For enter");
	define("_EMAIL_PASSW_FORWARD","Password by E-Mail Forward ");
	define("_REGISTRATI","please register");
	define("_WELCOME","Welcome");
	define("_MODIFICA_IMPOSTAZIONI","setup");
	define("_REMEMBER_PASSWORD","Remember my Password");
	break;

    default:
	define("_USER_LOGIN","User Login");
	define("_USER","Utente");
	define("_PASSWORD","Password");
	define("_PER_ENTRARE","Per entrare");
	define("_EMAIL_PASSW_FORWARD","Recupero Password via E-Mail ");
	define("_REGISTRATI","Registrati");
	define("_WELCOME","Benvenuto");
	define("_MODIFICA_IMPOSTAZIONI","impostazioni");
	define("_REMEMBER_PASSWORD","Ricordami la mia Password");
	break;
}



?>

<style>

div.table.block.login form
{
	margin: 0;
	text-align: center;
}

div.table.block.login input
{
	margin: 2px;
}

</style>

 <?php structure_openBlock("table block login","Login",""); ?>

    <p>

<p align='left'> <img src='<?=$path;?>/<?=$block;?>/images/User_Card.png' width='70' height='70' border="0">

<?php $user=user_getuser(); if ($user==""){ ?>

	<form action="index.php?user_op=login" method="post" enctype="multipart/form-data">

		<?=_USER?><br />

		<input name='user' type="text" value="" /> <br />


		<?=_PASSWORD?> <br />

		<input name='password' type="password" value="" /> <br />


		<input type="submit" value="login" /> <br />

		<?=_PER_ENTRARE?> <a href="index.php?appname=_reguser&subapp=02_reguser"><?=_REGISTRATI?></a><br><br>
		<?=_EMAIL_PASSW_FORWARD?> <a href="index.php?appname=_reguser&subapp=99_rememberpassword"><?=_REMEMBER_PASSWORD?></a>
	</form>
<?php }else{ ?>
	<?php if ($user_avatar=user_getkey($user,"user_avatar")) { ?>

		<p align="center" >
		    <?php if ($user_avatar!="") {
			if (substr($user_avatar,0,5)=="http:"){ ?>
			    <img src="<?=$user_avatar?>" />
			<?php } else { ?>
			    <img src="libs/avatars/<?=$user_avatar?>" />
			<?php } ?>
		    <?php } ?>
		</p>

	<?php } ?>

	<p align="center" >
	    <?=_WELCOME?> <b><?=$user;?></b><br />
	    <a href="index.php?appname=_reguser&subapp=02_reguser" ><?=_MODIFICA_IMPOSTAZIONI?></a>
	</p>
    <?php
	//plugins auto load
	$i=0;
	$fd=opendir("$path/$block/plugins");
	while (false !== ($nf= readdir($fd))){
	    if ($nf[0]!='.' && $nf[0]!='_'  )
		$plugins[$i++]=$nf;
	}
	closedir($fd);
	if ($i>0){
	    sort($plugins);
	    foreach($plugins as $plugin){
		if (is_dir("$path/$block/plugins/$plugin"))
		    include "$path/$block/plugins/$plugin";
		else
		    include "$path/$block/plugins/$plugin";
	    }
	}

    ?>

	<hr />


	<form action="index.php?user_op=logout"  method="post" enctype="multipart/form-data">

		<input type="submit" value="logout">

	</form>
<?php }?>


</p>

<?php structure_closeBlock(); ?>
